package com.gljx.web.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.gljx.web.Entity.Remuneration;
import com.gljx.web.dao.CommonDao;
import com.gljx.web.dao.RemunerationMapper;
import com.gljx.web.service.RemunerationService;

@Service
@Transactional
public class RemunerationServiceImpl extends CommonDao implements RemunerationService {
	
	@Autowired
	private RemunerationMapper remunerationMapper;
	
	/**
	 * 查找薪酬项目全部信息
	 */
	@Override
	public List<Remuneration> selectRemunerationList(String fcompanyid) {
		// TODO Auto-generated method stub
		return remunerationMapper.selectRemunerationList(fcompanyid);
	}
	/**
	 * 查找薪酬项目单条信息
	 */
	@Override
	public Remuneration selectByPrimaryKey(String fid) {
		// TODO Auto-generated method stub
		return remunerationMapper.selectByPrimaryKey(fid);
	}
	/**
	 * 增加薪酬信息
	 */
	@Override
	public int addRemuneration(Remuneration remuneration) {
		// TODO Auto-generated method stub
		return remunerationMapper.insertSelective(remuneration);
	}
	/**
	 * 修改薪酬信息
	 */
	@Override
	public int updateRemuneration(Remuneration remuneration) {
		// TODO Auto-generated method stub
		return remunerationMapper.updateByPrimaryKeySelective(remuneration);
	}
	
	@Override
	public Map<String, Object> selectPage(int pindex, String psql, int psize) {
		// TODO Auto-generated method stub
		Map<String, Object> paramMap = new HashMap<String, Object>();
	    paramMap.put("Pindex", pindex);
	    paramMap.put("Psql", psql);
	    paramMap.put("Psize", psize);
	    paramMap.put("Pcount", oracle.jdbc.OracleTypes.INTEGER);
	    paramMap.put("v_cur", oracle.jdbc.OracleTypes.CURSOR);
	    this.getSqlSession().select("com.gljx.web.dao.RemunerationMapper.pagemap", paramMap, null);
	    return  paramMap;
	}
	@Override
	public Map<String, Object> selectPageCount(String psql) {
		// TODO Auto-generated method stub
		 Map<String, Object> paramMap = new HashMap<String, Object>();
	     paramMap.put("Psql", psql);
	     paramMap.put("Pcount", oracle.jdbc.OracleTypes.INTEGER);
	     this.getSqlSession().select("com.gljx.web.dao.RemunerationMapper.pagecount", paramMap, null);
	     return paramMap;
	}
	
	/**
	 * 根据名称查询薪酬信息
	 */
	@Override
	public List<Remuneration> selectRemunerationByFname(String fnameL2,String companyId) {
		// TODO Auto-generated method stub
		Map<String, String> map = new HashMap<>();
		map.put("fnameL2", fnameL2);
		map.put("fid", companyId);
		return remunerationMapper.selectRemunerationByFname(map);
	}
	/**
	 * 根据fid删除薪酬信息
	 */
	@Override
	public int deleteRemunerationByFid(String fid) {
		// TODO Auto-generated method stub
		return remunerationMapper.deleteByPrimaryKey(fid);
	}
	@Override
	public String selectFnumber(String companyId) {
		// TODO Auto-generated method stub
		return remunerationMapper.selectFnumber(companyId);
	}

}
